#ifndef RUNTIMEINFO
#define RUNTIMEINFO
#include <windows.h>
#include "ftpprofiles.hpp"
#include <vector>
#include <map>
#include <boost/date_time/posix_time/posix_time.hpp>
using std::vector;
using std::map;
using namespace boost::posix_time;


namespace com_oocl_monitor {
	namespace domain {
		class RunTimeInfo {
		public:
			explicit RunTimeInfo(FtpProfileList &configs, int interval = 30);
			~RunTimeInfo();
			void load(FtpProfileList &configs,int interval=30);
			ptime getEndTime(const string& profileName);
			void setEndTime(const string& profileName, const ptime& endTime);
			ptime getStartTime(const string& profileName);
			void setStartTime(const string& profileName, const ptime& startTime);

			void setTime(const string& profileName);

			int getRuncount(const string& profileName);
			void incrRuncount(const string& profileName);
			void resetRuncount(const string& profileName);
			void setInterval(int interval);
			int getInterval();
			void setStatus(const string& profileName, bool flag);
			bool getStatus(const string &profileName);
		private:
			RunTimeInfo(const RunTimeInfo&);
			RunTimeInfo &operator=(const RunTimeInfo&);
		private:
			struct Info {
				ptime _startTime;
				ptime _endTime;
				int _runCount;
				bool _isRunning;
			};
			map<string, Info> _timeInfo;
			SRWLOCK _lock;
			int _interval;
		};
	}
}

#endif // RUNTIMEINFO

